import 'package:hzy_normal_tool/hzy_normal_tool.dart';

import '../../common/index.dart';
import '../../tools/index.dart';
import '../theme/theme_data.dart';

class SpConfig {
  /// 存主题
  /// 0 白色
  /// 1 黑色
  /// 2 跟随系统
  static Future<bool> setThemeType({
    required int type,
  }) async {
    bool yorn = await SharedPreferencesTool.putInt(
          SpIdConstanst.themeType,
          type,
        ) ??
        false;
    debugLog("setThemeType: ${yorn ? "成功" : "失败"}");
    return yorn;
  }

  /// 取主题
  /// 0 白色
  /// 1 黑色
  /// 2 跟随系统
  static int themeType() {
    int type = SharedPreferencesTool.getInt(
          SpIdConstanst.themeType,
          defValue: defaulThemeType,
        ) ??
        defaulThemeType;
    debugLog("themeType: $type");
    return type;
  }
}
